﻿using System;
using System.Collections.Generic;
using System.Text;

using MSDASC;
using ADODB;

namespace FreeFlow.Administration.WinFormsControls
{
  /// <summary>
  /// A class that provides the UI to build a connection string
  /// </summary>
  public static class ConnectionStringBuilder
  {
    /// <summary>
    /// Builds a connection string by showing the connection string builder dialog.
    /// </summary>
    public static string GetConnectionString()
    {
      // show connection string builder
      DataLinks mydlg = new DataLinks();
      _Connection ADOcon;

      //Cast the generic object that PromptNew returns to an ADODB._Connection.
      ADOcon = (_Connection) mydlg.PromptNew();

      if (ADOcon != null)
      {
        return ADOcon.ConnectionString;
      }
      else
        return null;
    }
  }
}
